package com.zjut.azhen.DBDesign.mapping;

import com.zjut.azhen.DBDesign.bean.Students;
import com.zjut.azhen.DBDesign.bean.Teacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
/**
 * @author asus
 */
@Repository
public interface TeacherMapper {
    @Select("select * from zhengjy_teachers")
    List<Teacher> getAll();

    @Update("update zhengjy_teachers set tname=#{tname} ,tage=#{tage},tsex=#{tsex},ttel=#{ttel} where tno=#{tno}")
    Integer updateTeacher(Teacher teacher);

    @Insert("insert into zhengjy_teachers values(#{tno},#{tname},#{tage},#{tsex},#{tlevel},#{ttel})")
    Integer insertTeacher(Teacher teacher);

    //TODO:delete trigger needed

    @Delete("delete from zhengjy_teachers where tno=#{id}")
    Integer deleteTeacherByid(String id);

    @Insert("update zhengjy_sc set Score=#{score} where Cno=#{cno} AND Sno#{Cno}")
    Integer insertScore(String sno, String cno, Float score);
}
